<%@ page language="java" pageEncoding="UTF-8"%>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="../common/meta.jsp"%>
<%@ include file="../common/taglibs.jsp"%>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/easyui/themes/myself/easyui.css" />
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/easyui/themes/icon.css" />
<style>
* {
	margin: 0;
	padding: 5px;
	font-size: 12px;
}
</style>
<script type="text/javascript">
	function saveCategory() {
		parent.$.messager.progress();
		$("#ctDictForm").form("submit",{
			url: "save.action?operate=${operate}",			
			onSubmit: function() {
				var categoryName = this['categoryName'];
				if ($.trim(categoryName.value) == "") {
					parent.$.messager.progress('close');
					alert("请输入产品类别名称！");
					categoryName.focus();
					return false;
				}
				var optionText = this['optionText'];
				if ($.trim(optionText.value) == "") {
					parent.$.messager.progress('close');
					alert("请输入名称！");
					optionText.focus();
					return false;
				}
				var optionValue = this['optionValue'];
				if ($.trim(optionValue.value) == "") {
					parent.$.messager.progress('close');
					alert("请输入值！");
					optionValue.focus();
					return false;
				}
				var sort = this['sort'];
				var reg = /^\d*$/;
				if ($.trim(sort.value) != "" && !reg.test(sort.value)) {
					parent.$.messager.progress('close');
					alert("请输入数字！");
					sort.focus();
					return false;
				}
			},
			success: function(data) {
				parent.$.messager.progress('close');
				parent.$.messager.alert('消息','保存成功!','info');
				parent.$("#tc").tabs('getSelected').find('#content').attr('src','./system/dict/dictManage.action?criteria.category=' + document.getElementById('categoryName').value);
			},
			error: function() {
				parent$.messager.progress('close');
				parent$.messager.alert('错误','保存成功,请重试!','error');
			}
		});
	}
</script>
</head>
<body>
	<form id="ctDictForm" action="dictEdit.action" method="post"
		target="_self">
		<input type="hidden" name="dict.id" value="${dict.id}" /> <input
			type="hidden" name="dict.version" value="${dict.version}" />
		<table border="0" align="center" cellpadding="3" cellspacing="1"
			class="tb_input">
			<tr>
				<td class="td_title" nowrap="nowrap" width="200px">类别名称<font
					color="#FF0000">*</font></td>
				<td><input type="text" id="categoryName" name="dict.category"
					value="${dict.category}" style="WIDTH: 250px"
					<s:if test="%{operate !='insert'}">readonly</s:if> /></td>
			</tr>
			<tr>
				<td class="td_title" nowrap="nowrap" width="200px">名称<font
					color="#FF0000">*</font></td>
				<td><input type="text" id="optionText" name="dict.optionText"
					value="${dict.optionText}" style="WIDTH: 250px" /></td>
			</tr>
			<tr>
				<td class="td_title" nowrap="nowrap" width="200px">值<font
					color="#FF0000">*</font></td>
				<td><input type="text" id="optionValue" name="dict.optionValue"
					value="${dict.optionValue}" style="WIDTH: 250px" /></td>
			</tr>
			<tr>
				<td class="td_title" nowrap="nowrap" width="200px">顺序</td>
				<td><input type="text" id="sort" name="dict.sort"
					value="${dict.sort}" style="WIDTH: 250px" /></td>
			</tr>
		</table>
		<br />
		<table border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td align="center"><input type="button" value="保存"
					class="button_std" onclick="saveCategory()" /> &nbsp; <input
					type="button" value="返回" class="button_std"
					onclick="history.go(-1)" /></td>
			</tr>
		</table>
	</form>
</body>
</html>